import AMISRenderer from "@/components/AMISRenderer.tsx";

const userCenterSchema = {
    "type": "dialog",
    "title": "个人中心",
    "actions": [],
    "body": [
        {
            "type": "tabs",
            "tabs": [
                {
                    "title": "基本资料",
                    "body": [
                        {
                            "type": "form",
                            "title": "",
                            "body": [
                                {
                                    "label": "用户名称",
                                    "type": "input-text",
                                    "name": "user.userName",
                                    "id": "u:b0c88b395e0b",
                                    "static": true
                                },
                                {
                                    "label": "所属部门",
                                    "type": "input-text",
                                    "name": "user.dept.deptName",
                                    "id": "u:b0c88b395e0b",
                                    "static": true
                                },
                                {
                                    "type": "input-text",
                                    "label": "用户昵称",
                                    "name": "user.nickName",
                                    "id": "u:4787173de0a3"
                                },
                                {
                                    "type": "input-text",
                                    "label": "手机号码",
                                    "name": "user.phonenumber",
                                    "id": "u:6b98891dcb7c"
                                },
                                {
                                    "type": "input-email",
                                    "label": "邮箱",
                                    "name": "user.email",
                                    "id": "u:5fc14d5b8168",
                                    "validations": {},
                                    "validationErrors": {}
                                },
                                {
                                    "type": "radios",
                                    "label": "性别",
                                    "name": "user.sex",
                                    "options": [
                                        {
                                            "label": "男",
                                            "value": "0"
                                        },
                                        {
                                            "label": "女",
                                            "value": "1"
                                        }
                                    ],
                                    "id": "u:269c9a80927e",
                                    "value": "0"
                                }
                            ],
                            "mode": "horizontal",
                            "id": "u:dafa8685ed8f",
                            "initApi": {
                                "url": "/system/user/profile",
                                "method": "get"
                            },
                            "api": {
                                "url": "/system/user/profile",
                                "method": "put"
                            },
                            "panelClassName": "no-border",
                            "submitText": "保存"
                        }
                    ],
                    "id": "u:2eb692b76265"
                },
                {
                    "title": "修改密码",
                    "body": [
                        {
                            "type": "form",
                            "id": "u:e4f7bf66c8cc",
                            "title": "",
                            "body": [
                                {
                                    "label": "旧密码",
                                    "type": "input-password",
                                    "name": "oldPassword",
                                    "id": "u:b1199bc4f5a0",
                                    "showCounter": false,
                                    "validations": {},
                                    "validationErrors": {},
                                    "required": true
                                },
                                {
                                    "type": "input-password",
                                    "label": "新密码",
                                    "name": "newPassword",
                                    "id": "u:5e560b5da094",
                                    "showCounter": false,
                                    "validations": {},
                                    "validationErrors": {},
                                    "required": true
                                },
                                {
                                    "type": "input-password",
                                    "label": "确认密码",
                                    "name": "confNewPassword",
                                    "id": "u:c1ba850736e3",
                                    "showCounter": false,
                                    "validations": {},
                                    "validationErrors": {},
                                    "required": true
                                }
                            ],
                            "mode": "horizontal",
                            "api": {
                                "url": "/system/user/profile/updatePwd",
                                "method": "put",
                                "requestAdaptor": "",
                                "adaptor": "",
                                "messages": {}
                            },
                            "panelClassName": "no-border",
                            "wrapWithPanel": true,
                            "submitText": "保存"
                        }
                    ],
                    "id": "u:ddaf55fb31c4"
                },
                {
                    "title": "三方账号绑定",
                    "body": [
                        {
                            "type": "crud",
                            "id": "u:28d546723d83",
                            "syncLocation": false,
                            "api": {
                                "method": "get",
                                "url": "/system/social/list"
                            },
                            "columns": [
                                {
                                    "name": "source",
                                    "label": "绑定账号平台",
                                    "type": "text",
                                    "id": "u:1fecf6fe28b6"
                                },
                                {
                                    "type": "image",
                                    "label": "头像",
                                    "name": "avatar",
                                    "id": "u:7206204df55f",
                                    "width": 50,
                                    "height": 50
                                },
                                {
                                    "type": "text",
                                    "label": "系统账号",
                                    "name": "userName",
                                    "id": "u:0398b3386555"
                                },
                                {
                                    "type": "text",
                                    "label": "绑定时间",
                                    "name": "createDate",
                                    "id": "u:02b0a46e33e8"
                                },
                                {
                                    "type": "operation",
                                    "label": "操作",
                                    "buttons": [
                                        {
                                            "type": "button",
                                            "label": "解绑",
                                            "actionType": "ajax",
                                            "level": "link",
                                            "className": "text-danger",
                                            "confirmText": "确定要解绑？",
                                            "api": {
                                                "method": "delete",
                                                "url": "/auth/unlock/${id}"
                                            },
                                            "id": "u:15ef777a9a37"
                                        }
                                    ],
                                    "id": "u:bb1a97edcc89"
                                }
                            ],
                            "bulkActions": [],
                            "itemActions": [],
                            "features": [
                                "delete"
                            ]
                        }
                    ],
                    "id": "u:9a6d18d015c7"
                }
            ],
            "id": "u:86918812d2d2"
        }
    ],
    "showCloseButton": true,
    "showErrorMsg": true,
    "showLoading": true,
    "className": "app-popover",
    "id": "u:374a810e5dc5",
    "closeOnEsc": false,
    "size": "lg"
}
const UserCenter: React.FC = ()  => {

    return (
        <AMISRenderer schema={userCenterSchema}></AMISRenderer>
    );
};

export default UserCenter;